package com.zgjkhis.modules.outpatient.service.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zgjkhis.modules.outpatient.domain.AccountLabel;
import com.zgjkhis.modules.outpatient.dto.AccountLabelDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author yxl
 * @Description
 * @Date 2021/7/19 11:16
 **/
@Repository
public interface AccountLabelMapper extends BaseMapper<AccountLabel> {

    /**
     * @Author yzq
     * @Description 根据用户id查询用户标签列表
     * @Date 2021/9/3 11:34
     * @Param [id]
     * @return java.util.List<com.zgjkhis.modules.outpatient.dto.AccountLabelDto>
     **/
    @Select("<script>select t.*,b.label_name from (\n" +
            "select * from his_account_label where account_id=#{id})t\n" +
            "left join his_label b on t.label_id=b.id</script>")
    List<AccountLabelDto> findListByAccountId(@Param("id") Long id);
}
